import request from '@/utils/request'

// 删除帖子
export function deletePost(id) {
  return request({
    url: `/api/v1/community/posts/${id}`,
    method: 'delete'
  })
}

// 获取帖子详情
export function getPostDetail(id) {
  return request({
    url: `/api/v1/community/posts/${id}`,
    method: 'get'
  })
}

// 获取帖子列表
export function getPostList(params) {
  return request({
    url: '/api/v1/community/posts',
    method: 'get',
    params
  })
}

// 获取所有可用标签
export function getAllTags() {
  return request({
    url: '/api/v1/community/posts/tags',
    method: 'get'
  })
}

// 获取热门标签
export function getHotTags(params) {
  return request({
    url: '/api/v1/community/posts/tags/hot',
    method: 'get',
    params
  })
}

// 获取指定标签的帖子列表
export function getPostsByTag(tagId, params) {
  return request({
    url: `/api/v1/community/posts/tags/${tagId}`,
    method: 'get',
    params
  })
}
